#include<iostream>
#include<vector>
#include<map>
using namespace std;
int N,n,A[2000010],ans[2000010],tot;
map<int,int>b;
vector<int>p[2000020];
void dfs1(int x,int sum,int o){
	if(x>N){
		if(b[sum]==0)b[sum]=++tot;
		p[b[sum]].push_back(o);
		return;
	}
	dfs1(x+1,sum+A[x],o|(1<<(x-1)));
	dfs1(x+1,sum-A[x],o|(1<<(x-1)));
	dfs1(x+1,sum,o);
}
void dfs2(int x,int sum,int o){
	if(x>n){
		int tmp=b[sum];
		if(tmp!=0){
			for(int i=0;i<p[tmp].size();i++){
				ans[p[tmp][i]|o]=1;
			}
		}
		return;
	}
	dfs2(x+1,sum+A[x],o|(1<<(x-1)));
	dfs2(x+1,sum-A[x],o|(1<<(x-1)));
	dfs2(x+1,sum,o);
}
int main(){
	cin>>n;N=n/2;
	for(int i=1;i<=n;i++)cin>>A[i];
	dfs1(1,0,0);
	dfs2(N+1,0,0); 
	int sum=0;
	for(int i=1;i<=(1<<n);i++)sum+=ans[i];
	cout<<sum;
}
